import java.util.ArrayList;
import java.util.List;
import java.util.Random;

abstract class Employee {
    String name;
    int salary;
    abstract public void calculateSalary();
}
class SalariedEmployee extends Employee {
    int monthSalary;
    public SalariedEmployee (String name,int monthSalary) {
        this.name = name;
        this.monthSalary = monthSalary;
    }
    @Override
    public void calculateSalary(){
        salary = monthSalary;
        System.out.println( "SalariedEmployee:"+name +",salary:"+salary);
    }
}
class HourlyEmployee extends Employee {
    int hours;
    int hourSalary;
    public HourlyEmployee (String name,int hourSalary,int hours) {
        this.name = name;
        this.hourSalary = hourSalary;
        this.hours = hours;
    }
    @Override
    public void calculateSalary(){
        salary = hourSalary*hours;
        System.out.println("HourlyEmployee:"+name +",hourSalary:"+hourSalary+",hours:"+hours+",salary:"+salary);
    }
}

public class SalaryClass {
    public static void main(String[] args) {
        List<Employee> employees = new ArrayList<>();
        Random random = new Random();
        for(int i = 1;i <= 10; i++){
            int employType = random.nextInt(2);
            switch (employType){
                case 0:
                    int monthSalary = random.nextInt(10000)+3000;
                    employees.add(new SalariedEmployee("001"+i,monthSalary));
                    break;
                case 1:
                    int hourSalary = random.nextInt(30) + 40;
                    int hours = random.nextInt(10) + 4;
                    employees.add(new HourlyEmployee("002"+i,hourSalary,hours));
                    break;
            }
        }

        for(Employee employee:employees){
            employee.calculateSalary();
        }
    }
}





